#ifndef H_COLFERS_UTILS_H
#define H_COLFERS_UTILS_H

#include <stdint.h>

#define COLFERS_LIKELY(x)   __builtin_expect(x,1)
#define COLFERS_UNLIKELY(x) __builtin_expect(x,0)

#ifdef __cplusplus
#define COLFERS_REINTERPRET_CAST(type,x) reinterpret_cast<type>(x)
#define COLFERS_STATIC_CAST(type,x) static_cast<type>(x)
#else
#define COLFERS_REINTERPRET_CAST(type,x) ((type)(x))
#define COLFERS_STATIC_CAST(type,x) ((type)(x))
#endif

#define COLFERS_POWER_OF_TWO32(exp) (COLFERS_STATIC_CAST(uint32_t,1) << exp)
#define COLFERS_POWER_OF_TWO64(exp) (COLFERS_STATIC_CAST(uint64_t,1) << exp)

#endif /* H_COLFERS_UTILS_H */

